<?php

include_once("functions/db_manipulate.php");
if (!init()) {
  redirect('?action=login');
}

$resultSet = subscribeToTopic($_GET['tid']);

$initiatorAction = \controller\ControllerUtil::getEncodedActionFromUrlWithParameters($_SERVER['HTTP_REFERER']);

if ($resultSet) {
  redirect("?action=msg&header=header.subscr.success&body=body.subscr.success&view=" . $initiatorAction);
} else {
  redirect("?action=msg&header=header.subscr.failed&body=body.subscr.failed&view=" . $initiatorAction);
}
